package nashorn;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.time.Duration;
import java.time.Instant;

public class InvokeMethod {
    private final static Logger log = LogManager.getLogger(InvokeMethod.class);
    Instant start;
    Instant end;

    public void init() {
        start = Instant.now();
        log.info(() -> "初始化操作......");
    }

    public String service(String str) {
        return "步骤一:" + str;
    }

    public String service2() {
        return "步骤二";
    }

    public String service3() {
        return "步骤3";
    }

    public void destory() {
        end = Instant.now();
        Duration time = Duration.between(start, end);
        log.info(() -> "销毁操作......，操作时间为:" + time.toMillis() + "ms");
    }
}
